package com.woniuxy.shop.Service.Serviceimpl;

import com.hc.entity.*;
import com.woniuxy.shop.Mapper.LLMapper;
import com.woniuxy.shop.Service.LLService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName LLService
 * @Description
 * @Author ll
 * @Date 2022/10/19 15:38
 * @Version 1.0
 **/
@Service("LLService")
public class LLServiceimpl implements LLService {
    @Autowired
    LLMapper llMapper;
    @Override
    public boolean isexitshop(int id) {
        Shop isexitshop = llMapper.isexitshop(id);
        boolean result = isexitshop==null;
        return result;
    }

    @Override
    public void insertshop(Shop shop) {
        shop.setStatus("x");
        llMapper.insertshop(shop);
    }

    @Override
    public boolean ispass(int id) {
        Shop ispass = llMapper.ispass(id);
        boolean result = ispass==null;
        return result;
    }

    @Override
    public void insertgoods(Goods goods) {
        goods.setStatus("n");
        llMapper.insertgoods(goods);
    }

    @Override
    public List<Goods> getmygoods(int id) {
        Shop ispass = llMapper.ispass(id);
        List<Goods> getmygoods = llMapper.getmygoods(5);
        return getmygoods;
    }

    @Override
    public Goods getgoodsdetail(int id) {
        Goods getgoodsdetail = llMapper.getgoodsdetail(id);
        return getgoodsdetail;
    }

    @Override
    public void changestock(int id, int stock) {
        llMapper.changestock(id,stock);
    }

    @Override
    public void offyheshelf(int id) {
        llMapper.offyheshelf(id);
    }

    @Override
    public List<Order> finish(int shopid) {
        List<Order> finish = llMapper.finish(shopid);
        return finish;
    }

    @Override
    public List<Order> allorder(int shopid) {
        List<Order> allorder = llMapper.allorder(shopid);
        return allorder;

    }

    @Override
    public List<Order> notfinish(int shopid) {
        List<Order> finish = llMapper.notfinish(shopid);
        return finish;
    }

    @Override
    public void addsecondkill(Seckill seckill) {
        llMapper.addsecondkill(seckill);
    }

    @Override
    public void addGoodsDiscountMid(int discount, int goodsId) {
        llMapper.addGoodsDiscountMid(discount,goodsId);
    }

    @Override
    public void addDiscountType(DiscountType discountType,int goodsid) {
        GoodsDiscountMid goodsDiscountMid = new GoodsDiscountMid();
        goodsDiscountMid.setGoodsId(goodsid);
        llMapper.addDiscountType(discountType);
        llMapper.addGoodsDiscountMid(discountType.getId(),goodsid);
    }

    @Override
    public void dayang(int shopid) {
        llMapper.dayang(shopid);
    }

    @Override
    public void openshop(int shopid) {
        llMapper.openshop(shopid);
    }

    @Override
    public Shop getshopstatus(int id) {
        return llMapper.getshopstatus(id);
    }
}